package cn.sytton.taffe.auth.controller;

import cn.sytton.taffe.framework.base.controller.BaseController;
import cn.sytton.taffe.framework.captcha.Captcha;
import cn.sytton.taffe.framework.captcha.CaptchaFactory;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 图形验证码控制层
 *
 * @author skyrock
 */
@Tag(name = "图形验证码")
@RestController
@RequestMapping("/auth/captcha")
public class CaptchaController extends BaseController {

    @Resource
    private CaptchaFactory captchaFactory;

    @Operation(summary = "获取图片验证码")
    @GetMapping("/code")
    public Captcha getCaptcha() {
        return captchaFactory.generateCode();
    }
}
